Skip to content

Say when nothing answers at the AI model's address - #1728

Merged
davidmckayv merged 1 commit into
mainfrom
fix/model-unreachable-message
Nov 16, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
fix/model-unreachable-message

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What was wrong

Seen on OpenBot Desktop: the AI model's address was an OpenAI-compatible base URL at host.docker.internal:48123 with nothing listening. The harness log showed openai.APIConnectionError ("All connection attempts failed"), and the conversation said only "The Bot stopped before it finished answering. Try again." Nothing said the model couldn't be reached, or where to change it. On the Claude Agent SDK harness the same address went on as a provider refusal ("Anthropic turned down the request"), which is wrong too: nobody answered.

What changes

  • LangChain harness (agent-langgraph-agui): a run whose model call never reached a model (connection refused, host not found, no answer in time: the OpenAI and Anthropic SDKs' APIConnectionError, APITimeoutError, and httpx's connect and timeout errors) now ends with a RUN_ERROR coded OPENBOT_MODEL_UNREACHABLE: "OpenBot couldn't reach the AI model at 127.0.0.1:48123. Check that it's running and the address is right."
  • Claude Agent SDK harness (agent-claude-sdk): Claude Code's own account of the same failures ("API Error: Connection refused …", "Can't reach the API server …", "No internet route …", "Unable to connect to API (…)", "Request timed out …") ends the run the same way, with the same sentence, on both its routes (a Claude Agent SDK Bot, and a built-in Bot on a Claude plan).
  • The address is host and port only. A user, password or path in the base URL is never shown.
  • The server puts the step that fits its edition in place of the second sentence: on OpenBot Desktop, "Check that it's running, or change the address in Settings under AI model"; elsewhere, "Ask an admin…". The code carries no other meaning, and no spec change is needed: RUN_ERROR codes are AG-UI event fields, not part of api/, and the app draws the message in its existing card.

Tests (red first)

  • agent-langgraph-agui/tests/test_tool_protocol.py: the real endpoint and the real OpenAI SDK against a loopback port with nothing listening (with a user and password in the URL that must not appear), and a .invalid host (DNS failure). Before: RUN_ERROR with no code and "The Bot stopped before it finished answering. Try again." After: the code and the sentence. Plus the timeout class.
  • agent-claude-sdk/tests/test_model_unreachable.py: the real Claude Code this harness ships, through both routes, against a closed port and a .invalid host. Before: OPENBOT_MODEL_REFUSED. After: OPENBOT_MODEL_UNREACHABLE and the sentence.
  • Both harness suites pass in full (171 and 140).

Known limit

On the Claude Agent SDK harness the sentence takes about three minutes to appear in a chat (measured 178 s refused, 183 s DNS), because Claude Code retries the connection ten times by itself first. Lowering that retry count would also cut its patience for rate limits and overloads, so it stays as is here; the follow-up is the durability item that lets a harness hand the provider's wait to the server. A delegated task's turn is already sent once and answers in seconds.

A model address with nothing listening, a host that doesn't resolve or one that never answers ended the run with "The Bot stopped before it finished answering. Try again." on the LangChain harness, and as a provider refusal on the Claude Agent SDK harness. Both now end the run coded OPENBOT_MODEL_UNREACHABLE, saying OpenBot couldn't reach the AI model at its host and port (never the rest of the URL), so the server can add the step that fits its edition.
@davidmckayv
davidmckayv force-pushed the fix/model-unreachable-message branch from 6a03b69 to fb60bee Compare November 16, 2026 20:25
@davidmckayv
davidmckayv merged commit d95f957 into main Nov 16, 2026
16 checks passed
@davidmckayv
davidmckayv deleted the fix/model-unreachable-message branch November 16, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant